

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>CephFS Top 工具 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/doctools.js"></script>
        <script src="../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="快照计划模块" href="../snap-schedule/" />
    <link rel="prev" title="升级 MDS 集群" href="../upgrading/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../">Ceph 文件系统</a></li>
      <li class="breadcrumb-item active">CephFS Top 工具</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../_sources/cephfs/cephfs-top.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 文件系统</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../#cephfs">CephFS 入门</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../#id4">管理</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../createfs/"> 创建 CephFS 文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../administration/"> 管理命令</a></li>
<li class="toctree-l3"><a class="reference internal" href="../multifs/"> 创建多个文件系统</a></li>
<li class="toctree-l3"><a class="reference internal" href="../add-remove-mds/"> 配备、增加、删除 MDS</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/">术语</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds">MDS 守护进程的引用</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#id3">故障切换的管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#standby-replay">热备（ standby-replay ）的配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../standby/#mds-join-fs">配置 MDS 与文件系统的亲和性</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cache-configuration/"> MDS 缓存配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mds-config-ref/"> MDS 配置选项</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../man/8/ceph-mds/"> ceph-mds 手册页</a></li>
<li class="toctree-l3"><a class="reference internal" href="../nfs/"> 通过 NFS 导出</a></li>
<li class="toctree-l3"><a class="reference internal" href="../app-best-practices/"> 应用最佳实践</a></li>
<li class="toctree-l3"><a class="reference internal" href="../fs-volumes/"> FS 卷和子卷</a></li>
<li class="toctree-l3"><a class="reference internal" href="../quota/"> CephFS 配额管理</a></li>
<li class="toctree-l3"><a class="reference internal" href="../health-messages/"> 健康消息</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading/">升级 MDS 集群</a></li>
<li class="toctree-l3"><a class="reference internal" href="../upgrading/#firefly-jewel">升级比 Firefly 老的文件系统，需过 Jewel 这个槛</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#"> CephFS Top 工具</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id2">管理器插件</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id3"><cite>cephfs-top</cite></a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="../snap-schedule/"> 定时快照</a></li>
<li class="toctree-l3"><a class="reference internal" href="../cephfs-mirroring/"> CephFS 快照镜像</a></li>
<li class="toctree-l3"><a class="reference internal" href="../purge-queue/"> 清理队列</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../#id5">挂载 CephFS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id6">CephFS 内幕</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id7">故障排除和灾难恢复</a></li>
<li class="toctree-l2"><a class="reference internal" href="../#id9">更多细节</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="cephfs-top">
<span id="id1"></span><h1>CephFS Top 工具<a class="headerlink" href="#cephfs-top" title="Permalink to this heading"></a></h1>
<p>CephFS 提供了一个 <cite>top(1)</cite> 风格的工具，用于实时显示各种 Ceph 文件系统指标。
<cite>cephfs-top</cite> 是一个基于 curses 的 Python 脚本，
它利用 Ceph 管理器中的 <cite>stats</cite> 插件来获取（并显示）指标。</p>
<section id="id2">
<h2>管理器插件<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<p>Ceph 文件系统客户端会周期性地把各种指标转发给 Ceph 元数据服务器 (MDS) ，
然后再由 MDS 的 rank 0 转发给 Ceph 管理器。每个活跃 MDS 都会把各自的指标集转发给 MDS 的 rank 0 。指标汇总后转发给 Ceph 管理器。</p>
<p>指标分为两类 - 全局指标和 MDS 个体指标。全局指标代表整个文件系统的指标集（例如，
客户端读延时），而 mds 个体指标则是一个特定 MDS rank 的（例如，这个 MDS 处理的子树数量）。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>目前，只追踪全局指标。</p>
</div>
<p><cite>stats</cite> 插件默认是禁用的，可以用下列命令启用：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph mgr module enable stats
</pre></div>
</div>
<p>启用后， Ceph 文件系统指标可以这样获取：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs perf stats
</pre></div>
</div>
<p>输出格式是 JSON ，包含以下字段：</p>
<ul class="simple">
<li><p><cite>version</cite>: stats 输出的版本</p></li>
<li><p><cite>global_counters</cite>: 全局性能指标列表</p></li>
<li><p><cite>counters</cite>: mds 个体性能指标列表</p></li>
<li><p><cite>client_metadata</cite>: Ceph 文件系统客户端元数据</p></li>
<li><p><cite>global_metrics</cite>: 全局性能计数器</p></li>
<li><p><cite>metrics</cite>: MDS 个体性能计数器（目前还是空的）、以及延迟的 rank</p></li>
</ul>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p><cite>delayed_ranks</cite> 是正在报告过期指标的一些活跃 MDS rank 。
这种情况可能是由于 MDS rank 0 和其他活跃 MDS 之间的（临时）网络问题。</p>
</div>
<p>指标可以从指定客户端和/或多个活跃 MDS 提取。
提取指定客户端的指标（比如 client-id 为 1234 的）：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs perf stats --client_id=1234
</pre></div>
</div>
<p>只提取活跃 MDS 一个子集（如 MDS rank 1 和 2）的指标：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph fs perf stats --mds_rank=1,2
</pre></div>
</div>
</section>
<section id="id3">
<h2><cite>cephfs-top</cite><a class="headerlink" href="#id3" title="Permalink to this heading"></a></h2>
<p><cite>cephfs-top</cite> 工具要靠 <cite>stats</cite> 插件提取性能指标，并按 <cite>top(1)</cite> 风格展示。
<cite>cephfs-top</cite> 工具在 <cite>cephfs-top</cite> 软件包里。</p>
<p>默认情况下， <cite>cephfs-top</cite> 以 <cite>client.fstop</cite> 用户的名义连接 Ceph 集群：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ ceph auth get-or-create client.fstop mon &#39;allow r&#39; mds &#39;allow r&#39; osd &#39;allow r&#39; mgr &#39;allow r&#39;
$ cephfs-top
</pre></div>
</div>
<section id="id4">
<h3>字段描述<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h3>
<ol class="arabic simple">
<li><dl class="simple">
<dt>chit<span class="classifier">Cap hit</span></dt><dd><p>用到的能力占能力总数的百分比</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>dlease<span class="classifier">Dentry lease （dentry 租约）</span></dt><dd><p>发放出去的 dentry 租约占 dentry 租约请求总数的百分比</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>ofiles<span class="classifier">Opened files （打开的文件）</span></dt><dd><p>打开的文件数</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>oicaps<span class="classifier">Pinned caps （锁定的能力）</span></dt><dd><p>被锁定的能力数量</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>oinodes<span class="classifier">Opened inodes （打开的 inode ）</span></dt><dd><p>打开的 inode 数量</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>rtio<span class="classifier">Total size of read IOs （读 IO 总尺寸）</span></dt><dd><p>所有进程产生的 IO 操作中，读出的总字节数。</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>wtio<span class="classifier">Total size of write IOs （写 IO 总尺寸）</span></dt><dd><p>所有进程产生的 IO 操作中，写入的总字节数。</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>raio<span class="classifier">Average size of read IOs （读 IO 平均尺寸）</span></dt><dd><p>所有进程产生的所有已完成的读出 IO 操作，它们的平均字节数。</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>waio<span class="classifier">Average size of write IOs （写 IO 平均尺寸）</span></dt><dd><p>所有进程产生的所有已完成的写入 IO 操作，它们的平均字节数。</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>rsp<span class="classifier">Read speed （读速度）</span></dt><dd><p>从上次刷新客户端以来的读取 IO 速度。</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>wsp<span class="classifier">Write speed （写速度）</span></dt><dd><p>从上次刷新客户端以来的写入 IO 速度。</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>rlatavg<span class="classifier">Average read latency （读延时均值）</span></dt><dd><p>读延时的平均值</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>rlatsd<span class="classifier">Standard deviation (variance) for read latency （读取延时的标准差［方差］）</span></dt><dd><p>读延时指标相对于平均值的离散程度</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>wlatavg<span class="classifier">Average write latency （写延时均值）</span></dt><dd><p>写延时平均值</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>wlatsd<span class="classifier">Standard deviation (variance) for write latency （写入延时的标准差［方差］）</span></dt><dd><p>写延时指标相对于平均值的离散程度</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>mlatavg<span class="classifier">Average metadata latency （元数据延时均值）</span></dt><dd><p>元数据延时的平均值</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>mlatsd<span class="classifier">Standard deviation (variance) for metadata latency （元数据延时的标准差［方差］）</span></dt><dd><p>元数据延时指标相对于平均值的离散程度</p>
</dd>
</dl>
</li>
</ol>
</section>
<section id="id5">
<h3>命令行选项<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h3>
<p>要用非默认用户（ <cite>client.fstop</cite> 以外的），像这样：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cephfs-top --id &lt;name&gt;
</pre></div>
</div>
<p>默认情况下， <cite>cephfs-top</cite> 连接的是集群名 <cite>ceph</cite> ，用非默认集群名的话：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cephfs-top --cluster &lt;cluster&gt;
</pre></div>
</div>
<p><cite>cephfs-top</cite> 默认每秒刷新统计信息。可以选用不同的刷新间隔：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cephfs-top -d &lt;seconds&gt;
</pre></div>
</div>
<p>刷新间隔应该是正整数。</p>
<p>只转储各个指标到标准输出，不创建 curses 显示屏，这样操作：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cephfs-top --dump
</pre></div>
</div>
<p>要转储指定文件系统的指标到标准输出，不创建 curses 显示屏：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ cephfs-top --dumpfs &lt;fs_name&gt;
</pre></div>
</div>
</section>
<section id="id6">
<h3>交互命令<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h3>
<ol class="arabic simple">
<li><dl class="simple">
<dt>m<span class="classifier">Filesystem selection （文件系统选择）</span></dt><dd><p>显示一个文件系统菜单，供选择。</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>s<span class="classifier">Sort field selection （选择排序字段）</span></dt><dd><p>指定排序字段，默认是 cap_hit 。</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>l<span class="classifier">Client limit （客户端限量）</span></dt><dd><p>限制要显示的客户端数量。</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>r<span class="classifier">Reset （重置）</span></dt><dd><p>把排序字段和限量数值重置成默认值。</p>
</dd>
</dl>
</li>
<li><dl class="simple">
<dt>q<span class="classifier">Quit （退出）</span></dt><dd><p>如果当前位于主屏幕（所有文件系统信息），就退出此工具；要不是就退回到主屏幕。</p>
</dd>
</dl>
</li>
</ol>
<p>显示的指标可以滚动，用方向键、 PgUp/PgDn 、 Home/End 和鼠标。</p>
<p>运行 <cite>cephfs-top</cite> 查看两个文件系统的示例截图：</p>
<img alt="../../_images/cephfs-top.png" src="../../_images/cephfs-top.png" />
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>cephfs-top 兼容的 python 版本最低是 3.6.0 。
cephfs-top 支持的发行版有 RHEL 8 、 Ubuntu 18.04 和 CentOS 8 及以上版本。</p>
</div>
</section>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../upgrading/" class="btn btn-neutral float-left" title="升级 MDS 集群" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../snap-schedule/" class="btn btn-neutral float-right" title="快照计划模块" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>